import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
import Home from "../views/Home.vue";
import AdminHome from "../views/admin/home/index.vue"

const routes: Array<RouteRecordRaw> = [
  {
    path: "/user",
    name: "Home",
    component: Home,
    children: [
      {
        path: "/user/home",
        name: "UserHome",
        component: () => import("../views/user/home/index.vue"),
      },
      {
        path: "/user/me",
        name: "Me",
        component: () => import("../views/user/me/index.vue"),
      },

      {
        path: "/user/news",
        name: "UserNews",
        component: () => import("../views/user/news/index.vue"),
      },
      {
        path: "/user/eye",
        name: "Eye",
        component: () => import("../views/user/eye/index.vue"),
      },
      {
        path: "/user/:catchAll(.*)*",
        name: "UserNotFound",
        component: () => import("../components/404/index.vue"),
      },

    ],
  },
  {
    path: "/admin",
    name: "AdminHome",
    component: AdminHome,
    children: [
      {
        path: "/admin/users",
        name: "AdminUsers",
        component: () => import("../views/admin/users/index.vue"),
      },
      {
        path: "/admin/boom",
        name: "AdminBoom",
        component: () => import("../views/admin/boom/index.vue"),
      },
      {
        path: "/admin/news",
        name: "AdminNews",
        component: () => import("../views/admin/news/index.vue"),
      },
      {
        path: "/admin/:catchAll(.*)*",
        name: "AdminNotFound",
        component: () => import("../components/admin404/index.vue"),
      },
    ],
  },
  {
    path: "/login",
    name: "adminlogin",
    component: () => import("../views/admin/login/index.vue"),
  },
  {
    path: "/newinfo",
    name: "newinfo",
    component: () => import("../views/user/home/newDeatil.vue"),
  },
  {
    path: "/userinfo",
    name: "userinfo",
    component: () => import("../views/user/me/userinfo.vue"),
  },
  {
    path: "/user/login",
    name: "userlogin",
    component: () => import("../views/user/me/userLogin.vue"),
  },
  {
    path: "/user/resetPass",
    name: "resetPass",
    component: () => import("../views/user/me/editPassword.vue"),
  },
  {
    path: "/:catchAll(.*)*",
    name: "NotFound",
    component: () => import("../components/admin404/index.vue"),
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
